from django.conf.urls import url

from meiduo_admin.views import channels,skus,spus,orders,permissions
from meiduo_admin.views import statistical
from meiduo_admin.views import users

urlpatterns = [
    # url(r'^authorizations/$', users.AdminAuthorizeView.as_view()),
    url(r'^authorizations/$', users.AdminAuthorizeView.as_view()),
    #用户总量
    url(r'^statistical/total_count/$', statistical.UserTotalCountView.as_view()),
    #日增
    url(r'^statistical/day_increment/$', statistical.UserDayCountView.as_view()),
    #日活
    url(r'^statistical/day_active/$', statistical.UserActiveAcountView.as_view()),
    #日下单
    url(r'^statistical/day_orders/$', statistical.UserOrderCountView.as_view()),
    #30天日增
    url(r'^statistical/month_increment/$', statistical.UserMonthCountView.as_view()),
    #商品
    url(r'^statistical/goods_day_views/$', statistical.GoodsDayViewsView.as_view()),
    #用户管理
    url(r'^users/$',users.UserInfoView.as_view()),
    #频道管理
    url(r'^goods/channel_types/$',channels.ChannelTypesView.as_view()),
    #频道组下以及分类
    url(r'^goods/categories/$',channels.ChannelCategoriesView.as_view()),
    #图片管理
    url(r'^skus/simple/$', skus.SKUSimageView.as_view()),
    #sku管理下新增商品的spu下拉栏
    url(r'^goods/simple/$', spus.SPUSimpleView.as_view()),
    #
    url(r'^goods/(?P<pk>\d+)/specs/$', spus.SPUSpecView.as_view()),
    #权限管理
    url(r'^permission/content_types/$', permissions.PermissionViewSet.as_view({
        'get':'content_types'
    })),
    # 用户组管理
    url(r'^permission/simple/$', permissions.GroupViewSet.as_view({
        'get':'simple'
    })),
    # 管理员管理
    url(r'^permission/groups/simple/$', permissions.AdminViewSet.as_view({
        'get': 'simple'
    })),
]

#频道管理
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('goods/channels',channels.ChannelViewSet,base_name='channels')
urlpatterns +=router.urls

#图片管理
router = DefaultRouter()
router.register('skus/images',skus.SKUImageViewSet,base_name='images')
urlpatterns += router.urls

# SKU商品管理
# from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('skus', skus.SKUViewSet, base_name='skus')
urlpatterns += router.urls

#订单管理
router = DefaultRouter()
router.register('orders', orders.OrderViewSet, base_name='orders')
urlpatterns += router.urls

#权限管理
router = DefaultRouter()
router.register('permission/perms', permissions.PermissionViewSet, base_name='perms')
urlpatterns += router.urls

#用户组管理
router = DefaultRouter()
router.register('permission/groups', permissions.GroupViewSet, base_name='groups')
urlpatterns += router.urls

#管理员管理
router = DefaultRouter()
router.register('permission/admins', permissions.AdminViewSet, base_name='admins')
urlpatterns += router.urls